import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const state = {
  // 导航栏
  activeNav: localStorage["activeNav"] ? localStorage["activeNav"] : 0,
  scrollTop_market: 0,
  scrollTop_home: 0,
  scrollTop_city: 0,
};

const mutations = {
  // 保存菜单栏状态
  change(state, data) {
    state.activeNav = data.tar;
    window.localStorage["activeNav"] = data.tar
  },
  scrollTop(state, data) {
    state[data.name] = data.value
  }
}

export default new Vuex.Store({
  state,
  mutations

})
